package com.vincent.kdp.ui.fragment.repository;

import com.loopj.android.http.RequestParams;
import com.vincent.baseapp.util.SPUtil;
import com.vincent.kdp.PostUrl;
import com.vincent.kdp.bean.JudgeBean;
import com.vincent.kdp.bean.MyCraftBean;
import com.vincent.kdp.bean.MyMetalColorBean;
import com.vincent.kdp.bean.MySeriesAdapterBean;
import com.vincent.kdp.bean.QualityBean;
import com.vincent.kdp.bean.SelectGoodsBean;
import com.vincent.kdp.bean.WareHouseGoodsBean;
import com.vincent.kdp.http.HttpUtil;
import com.vincent.kdp.http.RequestCallBack;
import com.vincent.kdp.ui.bean.response.BaseOutput;
import com.vincent.kdp.ui.bean.response.CommodityListOut;
import com.vincent.kdp.ui.bean.response.HotCommodityListOutput;
import com.vincent.kdp.util.BaseParam;

public class CommodityRepository {
    /**
     * 获取热门商品列表
     *
     * @param callBack 回调方法
     */
    public void reqHotCommodityList(RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_HOT_COMMODITY_LIST, params, HotCommodityListOutput.class, callBack);
    }

    public void reqNewListByseriesId(String seriesId, String number, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("seriesId", seriesId);
        params.put("number", number);
        HttpUtil.loadData(PostUrl.GET_NEW_COMMODITY_LIST, params, CommodityListOut.class, callBack);
    }

    public void reqGoodsList(Integer pageNum, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("pageNum", pageNum);
        params.put("series", SPUtil.getString("seriesId"));
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GOODS_LIST, params, CommodityListOut.class, callBack);
    }

    /**
     * 获取材质列表
     *
     * @param callBack 回调方法
     */
    public void reqQualityList(RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_QUALITY, params, QualityBean.class, callBack);
    }

    /**
     * 获取材质对应工艺
     *
     * @param callBack 回调方法
     */
    public void reqCraftList(String id, String styleId, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("categoryId", id);
        params.put("styleId", styleId);
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_Craft, params, MyCraftBean.class, callBack);
    }

    /**
     * 获取材质对应金属色
     *
     * @param callBack 回调方法
     */
    public void reqMetalColorList(String id, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("categoryId", id);
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_MetalColor, params, MyMetalColorBean.class, callBack);
    }

    /**
     * 获取 材质对应  类别详细 详细列表
     *
     * @param callBack 回调方法  cx待完成
     */
    public void reqQualityDetailList(String pageNum, String stylenum, String id, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("cStyleNum", stylenum);
        params.put("departId", id);
        params.put("pageNum", pageNum);
        HttpUtil.loadData(PostUrl.GET_STOCKLIST, params, WareHouseGoodsBean.class, callBack);
    }

    /**
     * 获取系列列表
     *
     * @param callBack 回调方法
     */
    public void reqSeriesList(RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_SERIES, params, MySeriesAdapterBean.class, callBack);
    }

    /**
     * 获取库存数据列表
     *
     * @param callBack 回调方法
     */
    public void reqDifferentHouseList(String pageNum, String stylenum, String id, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("cStyleNum", stylenum);
        params.put("departId", id);
        params.put("pageNum", pageNum);
        HttpUtil.loadData(PostUrl.GET_STOCKLIST, params, WareHouseGoodsBean.class, callBack);
    }


    /**
     * 搜索数据
     *
     * @param callBack 回调方法
     *                 category材质
     *                 strPrice   endPrice标价金额
     *                 <p>
     *                 strTotalWeight         endTotalWeight克重
     *                 <p>
     *                 style款式
     *                 series系列
     *                 companyStyleNum款号
     *                 strHandInch    endHandInch手寸
     *                 barCode商品码
     *                 <p>
     *                 <p>
     *                 <p>
     *                 number
     */
    public void reqSearchGoodsList(int page, String category, String strPrice, String endPrice, String strTotalWeight, String endTotalWeight
            , String style, String series, String companyStyleNum, String strHandInch, String endHandInch, String barCode,
                                   String metalColor,
                                   String craft,
                                   String strChainLength,
                                   String endChainLength,
                                   RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("pageNum", page);
        params.put("category", category);
        params.put("strPrice", strPrice);
        params.put("endPrice", endPrice);
        params.put("strTotalWeight", strTotalWeight);
        params.put("endTotalWeight", endTotalWeight);
        params.put("style", style);
        params.put("series", series);
        params.put("companyStyleNum", companyStyleNum);
        params.put("strHandInch", strHandInch);
        params.put("endHandInch", endHandInch);
        params.put("barCode", barCode);
        params.put("metalColor", metalColor);
        params.put("craft", craft);
        params.put("strChainLength", strChainLength);
        params.put("endChainLength", endChainLength);
        params.put("number", BaseParam.getDeviceId());

        HttpUtil.loadData(PostUrl.GET_GOODS_SEARCH, params, CommodityListOut.class, callBack);
    }

    /**
     * 获取申请调货
     *
     * @param callBack 回调方法
     */
    public void reqApplyGoods(String goodsId, String remark, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("goodsId", goodsId);
        params.put("remark", remark);
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_APPLY_GOODS, params, BaseOutput.class, callBack);
    }


    /**
     * 查询是否展示商品详情
     */
    public void getGoodsTurn(String barCode, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("barCode", barCode);
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_BUTTON, params, JudgeBean.class, callBack);
    }

}
